/** \file AudioAlsa.h
    \author belot.nicolas
    Audio Out via Alsa
*/

#ifndef AUDIOALSA_H
#define AUDIOALSA_H 1

#include "Audio.h"
#ifdef HAVE_LIBALSA
#include "alsa/asoundlib.h"

namespace libtrckr {


class AudioAlsa : public Audio {
/** \class libtrckr::AudioAlsa
    \brief output via Alsa.
*/
	public:
	AudioAlsa( );
	AudioAlsa(const AudioAlsa&);
	~AudioAlsa();
	void open( );
	audio_state_t state();
	void close( );

	int append(Buffer );

	void param(std::string, std::string);	
	void param(std::string, double);
	void param(std::string, int);

	int getFrame(double *,int);
	double *getAlsaBuffer();
	static double* _buffer;


	private:
	static int cnt;
	//void copy(Buffer);
	//double *_buffer;
	audio_state_t _state;
	snd_pcm_t *stream;
	//int start,end,size,capacity;

};

}
#endif

#endif

